package com.atguigu.flink.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class GetSourceFromSocket {

    public static void main(String[] args) throws Exception {

        // TODO 创建环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // TODO 从固定端口获取数据
        DataStreamSource<String> socketDS = env.socketTextStream("hadoop102", 8888);

        // TODO 打印
        socketDS.print();

        // TODO 提交作业
        env.execute();
    }
}
